package com.hkbigdata.userprofile.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hkbigdata.userprofile.bean.UserGroup;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 */
@DS("mysql")
public interface UserGroupMapper extends BaseMapper<UserGroup> {

    @DS("clickhouse")
    @Insert("${sql}") //${} #{} => #{} 加引号 ，${} 不加引号
    public void insertsql(@Param("sql") String sql);


    @DS("clickhouse")
    @Select("select arrayJoin(bitmapToArray(us)) us from user_group where user_group_id=#{id}")
    public List<String> getSelectUsergroupById(@Param("id") String id);


    @DS("clickhouse")
    @Select("${sql}")
    public Long getSelectUsergroupByIdCount(@Param("sql") String sql);


    @DS("clickhouse")
    @Delete("alter table user_group delete where user_group_id=#{id}")
    public Long DeleteUsergroupById(@Param("id") String id);
}
